<?php
Class Persons_model extends CI_Model {

  //Saves an user into the database
  function save($personid, $personname, $personlast1, $personlast2, $personphone, $personothers) {
	  $sql = "Save_Person '$personid', '$personname', '$personlast1', '$personlast2', '$personphone', '$personothers'"; 
    $query = $this->db->query($sql);
    return $query->num_rows();
  }

  function getallpersons() {
    $sql = "SELECT * FROM Personas";
    $query = $this->db->query($sql);
    return $query->result();
  }

  function getpersonbyid($id) {
    $sql = "SELECT * FROM Personas where id_persona = '$id'";
    $query = $this->db->query($sql);
    return $query->result();
  }

}
?>